package mx.vlabs.soapdroid.wsdl2java;

public class Artifact {
	
	private static String PARAM_KEY_OPENER = "\\$\\{";
	private static String PARAM_KEY_CLOSER = "\\}";
			
	private String name = "Artifact";
	private String id;
	private String content = "";
	
	public Artifact(String id, String content) {
		super();
		this.id = id;
		this.content = content;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getContent() {
		return content;
	}

	protected void setContent(String content) {
		this.content = content;
	}
	
	public Artifact setParam(String key,String value){
		content = content.replaceAll(getParamKeyExp(key), value);
		return this;
	}
	
	private String getParamKeyExp(String key){
		StringBuilder sb = new StringBuilder();
		
		sb.append(PARAM_KEY_OPENER);
		sb.append(key);
		sb.append(PARAM_KEY_CLOSER);
		
		return sb.toString();
	}
	
	public String toString(){
		return content;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	
	

}
